﻿using System.Threading.Tasks;
using Volo.Abp.Domain.Repositories;

namespace HuaskyErp.MaterialTypes;

public class MaterialTypeAppService: HuaskyErpAppService
{
    public IRepository<MaterialType> Repository { get; set; }
    public async Task<string> Greet()
    {
        await Task.Delay(1000);
        return "你好啊";   
    }

    /// <summary>
    /// 创建物料
    /// </summary>
    /// <param name="dto"></param>
    /// <returns></returns>
    public async Task<MaterialType> CreateAsync(MaterialTypeDto dto)
    {
        var material = new MaterialType(dto.Name, dto.Description);
        await Repository.InsertAsync(material);
        return material;
    }
}

public class MaterialTypeDto
{
    public string Name { get; set; }
    public string Description { get; set; }
}